#!/usr/bin/python
import sys
import os
import time

# Check for input argument
if len(sys.argv)<2:
	print "not enough arguments \n enter: power_parser.py [source path]"

else:

	# Open input file
	inputFile=open(sys.argv[1],"r")
	
	# Add a prefix to the output file if this is *nix
	outputPrefix = '';
	if sys.platform!='win32':
		outputPrefix += './'
	
	# Open the output files
	outputFileName = outputPrefix + 'power' + str(time.time()) + '.log'
	outputFile = open(outputFileName,"w")
	
	# Parse and write everything
	i = 0
	inputLines = inputFile.readlines()
	while i<len(inputLines):
		inputChunks = inputLines[i].split(' ')
		outputFile.write(str(float(0.1*int(inputChunks[5].strip()))) + "\n")
		i += 1
	
	# Print that we're finished
	print "Done, wrote to file " + outputFileName

